<template>
  <SysDialog draggable :title="dialog.title" :visible="dialog.visible" :width="dialog.width" :height="dialog.height"
    @onClose="onClose" @onConfirm="confirm">
    <template v-slot:content>
      <!-- 内容组件 -->
      <el-table v-loading="searchDate.Loading" :height="searchDate.height" :data="searchDate.list" style="width: 100%"
        :row-class-name="tableRowClassName">
        <el-table-column prop="fileName" show-overflow-tooltip label="文件名称" min-width="200" align="center" />
        <el-table-column prop="type" show-overflow-tooltip label="文件类型" min-width="200" align="center" />
        <el-table-column prop="versions" show-overflow-tooltip label="文件版本" min-width="200" align="center" />
        <el-table-column prop="versions" show-overflow-tooltip label="操作" min-width="200" align="center">
          <template #default="scoped">
            <el-button type="primary" @click="showBtn(scoped.row)">预览</el-button>
          </template>
        </el-table-column>

      </el-table>
    </template>
    <!-- 预览文件 -->
  </SysDialog>
  <Approval ref="RefApproval"></Approval>
</template>

<script setup lang='ts'>
import { ref } from 'vue'
import { ElForm } from 'element-plus';

import SysDialog from '@/components/SysDialog.vue';
import useDialog from '@/hooks/useDialog';
import useInstance from '@/hooks/useInstance';
import { EditType, Title } from '@/type/BaseEnum';
import moreHistoryModel from '../modelTs/moreHistory';
import ApprovalModel from '../modelTs/approval'
const { RefApproval, showBtn } = ApprovalModel()
// 使用
const { dialog, onShow } = useDialog()
const { global, proxy } = useInstance();
const { getMore, searchDate } = moreHistoryModel()
// 保存
const confirm = () => { }
const show = async (type: string, row?: any) => {
  console.log('show');
  dialog.width = 850
  dialog.height = 420
  dialog.title = '更多版本'
  onShow()
  await getMore(row)
  // global.$resetForm(addTemForm.value,dialogModel)
  // if(type === EditType.EDIT){
  //   global.$objCopy(row,dialogModel)
  // }
}
const tableRowClassName = ({ row, rowIndex }) => {
  if (rowIndex % 2 === 1) {
    return "warning-row";
  } else {
    return "success-row";
  }
}
const onClose = () => {
  // 清空数据 第一个是清空img 第二个就是 select 第三个就是 mark
  dialog.visible = false
}
defineExpose({
  show
})
</script>
<style scoped lang='scss'></style>